/** 
 * @jsName: ElevatorInfoManaged.js 
 * @author Sean Cui
 * @date 2017-04-16 下午3:46:00 
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @version V1.0.0.0
 * @comment 该文件通过代码生成器生成，如果修改次文件后，重新生成时将覆盖修改内容，请修改生成模板或做好备份
 */
function  getDaysByDateString(dateString1){  
    var  startDate=dateString1;//Date.parse(new Date(dateString1.replace('/-/g','/')));  
    var  endDate=new Date();//Date.parse(dateString2.replace('/-/g','/'));  
    var date3=endDate-startDate;  
    var days=Math.floor(date3/(24*3600*1000));  
      return  days;  
}   
var ElevatorInfoManaged = function() {
	return {
		datatable : null,
		files : null,
		init : function() {
			$(document).ajaxStart(function() {
				$("#global_isloading").css("display","");
			});
			$(document).ajaxStop(function() {
				$("#global_isloading").css("display", "none");
			});
			this.initSearch();
			this.initListener();
			//this.initKindEditor();
			//$("#global_isloading").css("display","");
		},
		initSearch : function() {
			if (!jQuery().dataTable) {
				return;
			}
			var _applyTag = jQuery("#_applyTag").val();
			var now = new Date(); 
			var day = now.getDate();
			var aoColumnDefs = [
								/*{
									"data" : "index",
									"aTargets" : [ 0 ]
								},*/
								{
									"aTargets" : [ 0 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls +=  full.registerCode;
										return htmls;
									}
								},
								{
									"aTargets" : [ 1 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls +=  full.deviceName;
										return htmls;
									}
								},
								{
									"aTargets" : [ 2 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls +=  full.placeType;
										return htmls;
									}
								},
								{
									"aTargets" : [ 3 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls +=  full.tenanceUnitname;
										return htmls;
									}
								},
								{
									"aTargets" : [ 4 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls += full.tenanceTel;
										return htmls;
									}
								},
								{
									"aTargets" : [ 5 ],
									"mRender" : function(data, type, full) {
										var htmls = '';
										htmls +=  full.useunitName;
										return htmls;
									}
								},
								{
									"aTargets" : [ 6 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls += full.deviceUseposition;
										return htmls;
									}
								},
								{
									"aTargets" : [ 7 ],
									"mRender" : function(data, type, full) {
										var htmls = '';
										htmls +=  full.deviceState;
										return htmls;
									}
								},
								{
									"aTargets" : [ 8 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										var orderState = full.orderState;
										var orderEndTime = full.orderEndTime;
										if (orderState)	{
											if (orderState=="0") {
												htmls += "<span style='color:#81c2d6'>未审核</span>";
											} else if (orderState=="1") {
												htmls += "<span style='color:#d9b3e6'>未付款</span>";
											} else if (orderState=="5") {
												htmls += "<span style='color:#dcf7a1'>驳回</span>";
											} else if (orderState=="6") {
												htmls += "<span style='color:#f2753f'>脱保</span>";
											} else if (orderState=="7") {
												htmls += "<span style='color:#f29f3f'>预警</span>";
//												var days = getDaysByDateString(orderEndTime);
//												if (days<0) {
//													if (days>=-30) {
//														htmls += "<span style='color:#f29f3f'>预警</span>";
//													} else {
//														htmls += "<span style='color:#8192d6'>已投保</span>";
//													}
//												}
											} else if (orderState=="4") {
												htmls += "<span style='color:#8192d6'>已投保</span>";
											}
										} else {
											htmls += "<span style='color:#00ff00'>未投保</span>";
										}
										return htmls;
									}
								},
								{
									"aTargets" : [ 9 ],
									"mRender" : function(data, type, full) {
										var btns =  '';
										var orderState = full.orderState;
										var orderEndTime = full.orderEndTime;
										if (orderState)	{
											if (orderState=="0") {
												//未审核
											} else if (orderState=="1") {
												btns +=  Permission.createPermElement('elevatorInfo:list:pay',' <button title="去支付" href="javascript:;" class="btn btn-sm  btn-danger" name="del" target_id="'+full.id+'">去支付</button>');
											} else if (orderState=="5") {
												btns +=  Permission.createPermElement('elevatorInfo:list:modfiyOrder',' <button title="修改投保单" href="javascript:;" class="btn btn-sm  btn-danger" name="del" target_id="'+full.id+'">修改投保单</button>');
											} else if (orderState=="6") {
												btns +=  Permission.createPermElement('elevatorInfo:list:applyOrder',' <button title="投保" href="javascript:;" class="btn btn-sm  btn-danger" name="toInsure" target_id="'+full.id+'">投保</button>');											
											} else if (orderState=="4") {
												var days = getDaysByDateString(orderEndTime);
												if (days<0) {
													if (days>=-60) {
														btns +=  Permission.createPermElement('elevatorInfo:list:applyOrder',' <button title="投保" href="javascript:;" class="btn btn-sm  btn-danger" name="toInsure" target_id="'+full.id+'">投保</button>');													
													} else {
														btns +=  Permission.createPermElement('elevatorInfo:list:viewOrder',' <button title="预览投保单" href="javascript:;" class="btn btn-sm  btn-danger" name="del" target_id="'+full.id+'">预览投保单</button>');	
													}
												}
											}
										} else {
											btns +=  Permission.createPermElement('elevatorInfo:list:applyOrder',' <button title="投保" href="javascript:;" class="btn btn-sm  btn-danger" name="toInsure" target_id="'+full.id+'">投保</button>');
										}
										btns +=  Permission.createPermElement('elevatorInfo:list:view',' <button title="电梯详情" href="javascript:;" class="btn btn-sm  btn-danger" name="del" target_id="'+full.id+'">电梯详情</button>');
										return btns;
									}
								}
						];
			if (_applyTag && _applyTag==1) {
				aoColumnDefs = [
								{
									"aTargets" : [ 0 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										var orderState = full.orderState;
										var orderEndTime = full.orderEndTime;
										if (orderState)	{
											if (orderState=="6" || orderState=="-1") {
												htmls +=  '<input type="checkbox" class="checkchild" value="'+full.id+'"/>';
											} else {
												//htmls +=  '<input type="checkbox" class="checkchild" disabled="disabled" value="'+full.id+'"/>';
											}
										} else {
											htmls +=  '<input type="checkbox" class="checkchild" value="'+full.id+'"/>';
										}
										return htmls;
									}
								},
								{
									"aTargets" : [ 1 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls +=  full.registerCode;
										return htmls;
									}
								},
								{
									"aTargets" : [ 2 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls +=  full.deviceName;
										return htmls;
									}
								},
								{
									"aTargets" : [ 3 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls +=  full.placeType;
										return htmls;
									}
								},
								{
									"aTargets" : [ 4 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls +=  full.tenanceUnitname;
										return htmls;
									}
								},
								{
									"aTargets" : [ 5 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls += full.tenanceTel;
										return htmls;
									}
								},
								{
									"aTargets" : [ 6 ],
									"mRender" : function(data, type, full) {
										var htmls = '';
										htmls +=  full.useunitName;
										return htmls;
									}
								},
								{
									"aTargets" : [ 7 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										htmls += full.deviceUseposition;
										return htmls;
									}
								},
								{
									"aTargets" : [ 8 ],
									"mRender" : function(data, type, full) {
										var htmls = '';
										htmls +=  full.deviceState;
										return htmls;
									}
								},
								{
									"aTargets" : [ 9 ],
									"mRender" : function(data, type, full) {
										var htmls =  '';
										var orderState = full.orderState;
										var orderEndTime = full.orderEndTime;
										if (orderState)	{
											if (orderState=="0") {
												htmls += "<span style='color:#81c2d6'>未审核</span>";
											} else if (orderState=="1") {
												htmls += "<span style='color:#d9b3e6'>未付款</span>";
											} else if (orderState=="5") {
												htmls += "<span style='color:#dcf7a1'>驳回</span>";
											} else if (orderState=="6") {
												htmls += "<span style='color:#f2753f'>脱保</span>";
											} else if (orderState=="7") {
												htmls += "<span style='color:#f29f3f'>预警</span>";
//												var days = getDaysByDateString(orderEndTime);
//												if (days<0) {
//													if (days>=-30) {
//														htmls += "<span style='color:#f29f3f'>预警</span>";
//													} else {
//														htmls += "<span style='color:#8192d6'>已投保</span>";
//													}
//												}
											} else if (orderState=="4") {
												htmls += "<span style='color:#8192d6'>已投保</span>";
											} else if (orderState=="-1") {
												htmls += "<span style='color:#00ff00'>未投保</span>";
											}
										} else {
											htmls += "<span style='color:#00ff00'>未投保</span>";
										}
										return htmls;
									}
								},
								{
									"aTargets" : [ 10 ],
									"mRender" : function(data, type, full) {
										var btns =  '';
										var orderState = full.orderState;
										var orderEndTime = full.orderEndTime;
										if (orderState)	{
											if (orderState=="0") {
												//未审核
											} else if (orderState=="1") {
												btns +=  Permission.createPermElement('elevatorInfo:list:pay',' <button title="去支付" href="javascript:;" class="btn btn-sm  btn-danger" name="del" target_id="'+full.id+'">去支付</button>');
											} else if (orderState=="5") {
												btns +=  Permission.createPermElement('elevatorInfo:list:modfiyOrder',' <button title="修改投保单" href="javascript:;" class="btn btn-sm  btn-danger" name="del" target_id="'+full.id+'">修改投保单</button>');
											} else if (orderState=="6") {
												btns +=  Permission.createPermElement('elevatorInfo:list:view',' <button title="投保" href="javascript:;" class="btn btn-sm  btn-danger" name="toInsure" target_id="'+full.id+'">投保</button>');											
											} else if (orderState=="4") {
												var days = getDaysByDateString(orderEndTime);
												if (days<0) {
													if (days>=-60) {
														btns +=  Permission.createPermElement('elevatorInfo:list:view',' <button title="投保" href="javascript:;" class="btn btn-sm  btn-danger" name="toInsure" target_id="'+full.id+'">投保</button>');													
													} else {
														btns +=  Permission.createPermElement('elevatorInfo:list:view',' <button title="预览投保单" href="javascript:;" class="btn btn-sm  btn-danger" name="del" target_id="'+full.id+'">预览投保单</button>');	
													}
												}
											} else if (orderState=="-1") {
												btns +=  Permission.createPermElement('elevatorInfo:list:view',' <button title="投保" href="javascript:;" class="btn btn-sm-table btn-success" name="toInsure" target_id="'+full.id+'">投保</button>');													
											}
										} else {
											btns +=  Permission.createPermElement('elevatorInfo:list:view',' <button title="投保" href="javascript:;" class="btn btn-sm-table btn-success" name="toInsure" target_id="'+full.id+'">投保</button>');
										}
										btns +=  Permission.createPermElement('elevatorInfo:list:view',' <button title="查看" href="javascript:;" class="btn btn-sm-table btn-danger" name="del" target_id="'+full.id+'">查看</button>');
										return btns;
									}
								}
						];
			}
			var listTable = $("#ElevatorInfoListTable").dataTable({
				"sAjaxSource" : ctx + "/elevatorInfo/search?now=" + new Date().getTime(),
				/* 使用post方式 */
				"fnServerData" : function(sSource, aoData, fnCallback) {
					var postData = {
						page : 1,
						start : 0,
						rows : 10,
						params : {}
					};
					
					if($('#searchregisterCode').val()){
						postData.params.searchregisterCode = "%"+($('#searchregisterCode').val()).replace(/\s/g,"%")+"%";
					}
//					
//					if($('#placeType').val()){
//						postData.params.placeType = ($('#placeType').val()).replace(/\s/g,"%");
//					}
					if($('#searchplaceType').val()){
						postData.params.searchplaceType = "%"+($('#searchplaceType').val()).replace(/\s/g,"%")+"%";
					}
					if($('#searchstate').val()){
						postData.params.searchstate = $('#searchstate').val();
					}

					// 参数
					for (var i = 0, size = aoData.length; i < size; i++) {
						if (aoData[i].name == 'iDisplayLength') {
							postData.rows = aoData[i].value;
						} else if (aoData[i].name == 'iDisplayStart') {
							postData.start = aoData[i].value;
						} else if (aoData[i].name == 'sEcho') {
							postData.page = aoData[i].value;
						}
					}

					$.ajax({
						"dataType" : 'json',
						"type" : "POST",
						"cache": false,
						"url" : sSource,
						"data" : postData,
						"success" : function(data, textStatus, jqXHR){
							fnCallback(data.data, textStatus, jqXHR);
						}
					});
				},
				"bAutoWidth":false,
				"aoColumnDefs" : aoColumnDefs
			});
			this.datatable = listTable;
		},reSearch:function(){
        	this.datatable.fnDraw();
        },removeClass:function(){//去除Form表单的验证样式
        	$('.form-group','#actForm').removeClass('has-success')
            .removeClass('has-error');
    		 $('span').remove('.help-block');
        },initListener : function() {
        	/**
        	 * 全选/全不选
        	 */
        	jQuery("body").on("click", ".checkall", function(){
        		var check = jQuery(this).prop("checked");
			    jQuery(".checkchild:enabled").prop("checked", check);
        	});
        	jQuery("body").on("click", "#applyOrderBtn", function() {
        		var postData = {
						page : 1,
						start : 0,
						rows : 10,
						params : {}
					};
        		var chk_value =[]; 
        		$('.checkchild:checked').each(function(){ 
        			chk_value.push($(this).val()); 
        		});
        		if (chk_value && chk_value.length>0) {
        			postData.params._chk_value = chk_value.join(",");
        			$.ajax({
        				"dataType" : 'json',
						"type" : "POST",
						"cache": false,
						"data" : postData,
        				"url" : ctx + '/elevatorInfo/setChecked?now='+new Date().getTime(),
        				"success" : function(data, textStatus, jqXHR){
        					if (data.type == 'success') {
        						window.location.href = ctx + '/insureOrderApply/apply.html?key='+data.data;
        					}
        				}
        			});
        		}
        	});
        	jQuery("body").on("click", "button[name='toInsure']", function() {
        		var postData = {
						page : 1,
						start : 0,
						rows : 10,
						params : {}
					};
        		var chk_value =[]; 
        		chk_value.push($(this).attr("target_id")); 
        		if (chk_value && chk_value.length>0) {
        			postData.params._chk_value = chk_value.join(",");
        			$.ajax({
        				"dataType" : 'json',
						"type" : "POST",
						"cache": false,
						"data" : postData,
        				"url" : ctx + '/elevatorInfo/setChecked?now='+new Date().getTime(),
        				"success" : function(data, textStatus, jqXHR){
        					if (data.type == 'success') {
        						window.location.href = ctx + '/insureOrderApply/apply.html?key='+data.data;
        					}
        				}
        			});
        		}
        	});
			/*
			 * 查询
			 */
			$("#searchBtn").click(function() {
				ElevatorInfoManaged.reSearch();
				return false;
			});

			/*
			 * 清除
			 */
			$("#clearBtn").click(function() {
				$("#searchForm")[0].reset();
				ElevatorInfoManaged.reSearch();
			});

			/*
			 * 添加
			 */
			$("#addBtn").click(function() {
				ElevatorInfoManaged.removeClass();
				$("div[name=editDlg] h4.modal-title").html("新增");
				$("#actForm")[0].reset();
				$("#actForm").find("input[name='id']").val("");
				$("#editDlg").modal("show");
			});
			
			$("#actFormBtn").click(function(){
				var form1 = $('#actForm');
				form1.validate({
					rules : {
						archiveNo:{
							maxlength : 25,
							required : true
						},
						registerCode:{
							maxlength : 25,
							required : true
						},
						deviceName:{
							maxlength : 25,
							required : true
						},
						deviceType:{
							maxlength : 25,
							required : true
						},
						deviceUseposition:{
							maxlength : 25,
							required : true
						},
						placeType:{
							maxlength : 25,
							required : true
						},
						placeArea:{
							maxlength : 25,
							required : true
						},
						placeAddress:{
							maxlength : 25,
							required : true
						},
						deviceState:{
							maxlength : 25,
							required : true
						},
						superviceState:{
							maxlength : 25,
							required : true
						},
						importTime:{
							maxlength : 25,
							required : true
						},
						areaId:{
							maxlength : 25,
							required : true
						},
						detailId:{
							maxlength : 25,
							required : true
						},
						classifyId:{
							maxlength : 25,
							required : true
						},
						useplaceId:{
							maxlength : 25,
							required : true
						},
						limityearId:{
							maxlength : 25,
							required : true
						}
					}
				});
				if(form1.valid()){
					var postData = $("form[name='actForm']").serializeJson();
					$.ajax({
						"dataType" : 'json',
						"cache": false,
						"type" : "POST",
						"data" : postData,
						"url" : ctx + "/elevatorInfo/edit?now="+new Date().getTime(),
						"success" : function(data) {
							if(data.type=='success'){
								$("#editDlg").modal("hide");
								BootstrapDialog.show({
									title : messages.public_cue_cue,
									message : messages.public_cue_saveOk,
									buttons : [ {
										label : messages.public_cue_sure,
										cssClass : 'btn btn-sm btn-primary',
										action : function(dialogItself) {
											ElevatorInfoManaged.reSearch();
											dialogItself.close();
										}
									} ]
								});
								
							}else{
								BootstrapDialog.show({
									type : BootstrapDialog.TYPE_WARNING,
									title : messages.public_cue_warning,
									message : data.message,
									buttons : [ {
										label : messages.public_cue_sure,
										cssClass : 'btn btn-sm btn-primary',
										action : function(dialogItself) {
											ElevatorInfoManaged.reSearch();
											dialogItself.close();
										}
									} ]
								});
							}
						}
					});
				}
			});
			
			/*
			 * 编辑
			 */
			$('#ElevatorInfoListTable tbody')
				.on('click', 'button[name="edit"]',function() {
					var id = $(this).attr("target_id");
					var form=$("form[name='actForm']");
					ElevatorInfoManaged.removeClass();
					$.ajax({
						"dataType" : 'json',
						"cache" : false,
						"type" : "POST",
						"data" : {},
						"url" : ctx + '/elevatorInfo/get/'+id+"?now="+new Date().getTime(),
						"success" : function(data, textStatus, jqXHR){
							if (data.type == 'success') {
								$(form).binddata(data.data);
								$("div[name=editDlg] h4.modal-title").html("编辑角色");
								$("#editDlg").modal("show");
							} else {
								BootstrapDialog.show({
									title : messages.public_cue_message,
									message : data.message,
									buttons : [ {
										label : messages.public_cue_sure,
										action : function(dialog) {
											dialog.close();
										}
									} ]
								});
							}
						}
					});
				});
			$('#ElevatorInfoListTable tbody')
				.on('click', 'button[name="del"]',function() {
					var id = $(this).attr("target_id");
					ElevatorInfoManaged.del(id);
				});
			
			/*
			 * 点击导入
			 */
            $("#import").click(function(e) {
                $("#filename").html("");
                $("#showImpDlg").modal("show");
                e.preventDefault();
            });

            /**
			 * 选择文件
             */
            $("#impelevator").click(function(){
                $(this).prev("input[type=file]").click();
            });

            $("input[type=file][name=excelFile]").change(function(){
                var that=this;
                var files=this.files;
                ElevatorInfoManaged.files = files;
                var fileFatuiles="";
                $.each(files, function(index, file) {
                    $("#filename").html(file.name);
                    //存放大于5M上传失败的
                    if(file.size > 5*1024*1024){
                        if(fileFatuiles==""){
                            fileFatuiles=fileFatuiles+file.name;
                        } else {
                            fileFatuiles=fileFatuiles+","+file.name;
                        }
                        return ;
                    }
                });
                if(fileFatuiles.length > 0){
                	$(this).val("");
                    alert(fileFatuiles+"文件太大，超过5M，请调整后上传!");
                }
            });

            /**
             * 开始上传文件
             */
            $("#startimp").click(function(){
            	var fileuploadUrl=ctx+"/elevatorInfo/import/excel?now="+new Date().getTime();
//                var fileuploadUrl=ctx+"/insureOrderApply/impExcel?now=" + new Date().getTime();
                var files = ElevatorInfoManaged.files;
                var fileFatuiles="";
               
                $.each(files, function(index, file) {
                    //存放大于5M上传失败的
                    if(file.size > 5*1024*1024){
                        if(fileFatuiles==""){
                            fileFatuiles=fileFatuiles+file.name;
                        } else {
                            fileFatuiles=fileFatuiles+","+file.name;
                        }
                        return ;
                    }
                    var data = new FormData();
                    data.append("excel", file);
                    
                    $.ajax({
                        data:data,
                        type: "POST",
                        url:fileuploadUrl,
                        cache: false,
                        contentType: false,
                        processData: false,
//                        xhr: function(){ //获取ajaxSettings中的xhr对象，为它的upload属性绑定progress事件的处理函数  
//                            
//                            myXhr = $.ajaxSettings.xhr();  
//                            if(myXhr.upload){ //检查upload属性是否存在  
//                                //绑定progress事件的回调函数  
//                                myXhr.upload.addEventListener('progress',progressHandlingFunction, false);   
//                            }  
//                            return myXhr; //xhr对象返回给jQuery使用  
//                        }, 
                        success: function(data) {
                            $('#excelFile').val("");
                            if(data['type'] == "success" ) {
                            	$("#closeimp").click();
                                BootstrapDialog.show({
                                    title: '信息',
                                    message: '导入成功！',
                                    buttons: [
                                        {
                                            label: '确定',
                                            cssClass: 'btn blue',
                                            action: function(dialog) {
                                            	ElevatorInfoManaged.reSearch();
                                                dialog.close();
                                            }
                                        }]
                                });
                            }else{
                                BootstrapDialog.show({
                                    title: '信息',
                                    message: data.message,
                                    buttons: [
                                        {
                                            label: '确定',
                                            cssClass: 'btn blue',
                                            action: function(dialog) {
                                            	ElevatorInfoManaged.reSearch();
                                                dialog.close();
                                            }
                                        }]
                                });
                                return;
                            }
                        },
                        error: function(XMLHttpRequest, textStatus, errorThrown) {
                            debugger;
                        },
                    });
                });
                if(fileFatuiles.length > 0){
                    alert(fileFatuiles+"文件太大，超过5M，请调整后上传!");
                }
            });
		},
		/**
		 * 删除
		 */
		del : function(id) {
			BootstrapDialog.show({
				type : BootstrapDialog.TYPE_WARNING,
				title : messages.public_cue_warning,
				message : messages.public_cue_delSure,
				buttons : [ {
					label : messages.public_cue_close,
					cssClass: 'btn btn-sm btn-default',
					action : function(dialogItself) {
						dialogItself.close();
					}
				}, {
					label : messages.public_cue_sure,
					cssClass : 'btn btn-sm btn-primary',
					action : function(dialogItself) {
						ElevatorInfoManaged.sureDel(id);
						dialogItself.close();
					}
				} ]
			});
		},
		sureDel : function(id){
			$.ajax({
				"dataType" : 'json',
				"cache": false,
				"type" : "POST",
				"data" : {},
				"url" : ctx + '/elevatorInfo/delete/'+id+"?now="+new Date().getTime(),
				"success" : function(data, textStatus, jqXHR){
					if (data.type == 'success') {
						BootstrapDialog.show({
							title : messages.public_cue_message,
							message : messages.public_cue_delSuccess,
							buttons : [ {
								label : messages.public_cue_sure,
								action : function(dialog) {
									ElevatorInfoManaged.reSearch();
									dialog.close();
								}
							} ]
						});
					} else {
						BootstrapDialog.show({
							title : messages.public_cue_message,
							message : data.message,
							buttons : [ {
								label : messages.public_cue_sure,
								action : function(dialog) {
									dialog.close();
								}
							} ]
						});
					}
				}
			});
		}
//		initKindEditor:function(){
//			
//			KindEditor.ready(function(K) {
//				//图片上传组件
//				var editor = K.editor({
//					uploadJson : ctx + '/kindeditor/uploadFileJson',
//					fileManagerJson : ctx + '/kindeditor/fileManagerJson',
//					allowFileManager : true
//				});
//				
//				K('#importBtn').click(
//					function() {
//					editor.loadPlugin('insertfile', function() {
//						editor.plugin.fileDialog({
//							showRemote : true,
//							clickFn : function(url, title, width,
//									height, border, align) {
//								if(null!=url&&url!=""){
//									urlArr = url.split("/");
//									var uData = {
//											params : {tempPath:("/"+urlArr[urlArr.length-2]+"/"+urlArr[urlArr.length-1])}
//										};
//									$("#global_isloading").css("display","");
//									$.ajax({
//										"dataType" : 'json',
//										"cache": false,
//										"type" : "POST",
//										"url" : ctx+"/elevatorInfo/import/excel?now="+new Date().getTime(),
//										"data" : uData,
//										"success" : function(data, textStatus, jqXHR){
//											$("#global_isloading").css("display", "none");
//											if (data.type=="error") {
//												alert(data.message);
//											} else {
//												ElevatorInfoManaged.reSearch();
//											}
//											//BoxManaged.reSearch();
//										}
//									});
//								}
//								editor.hideDialog();
//							}
//						});
//					});
//				});
//			});
//		}
	};

}();

/*
 * Powered By [Code-Generator]
 * Web Site: http://www.hwelltech.com
 */

